package cn.ddiancan.dm.constants;

public enum StatusEnum {
    INIT(1, "初始化"),
    PROCING(2, "处理中"),
    DONE(3, "已完成"),
    PART_DONE(4, "部分成功"),
    ERROR(5, "异常错误"),
    UNKNOW(6, "未知错误");
    private int code;
    private String description;

    StatusEnum(int code, String description) {
        this.code = code;
        this.description = description;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public static StatusEnum getStatusEnum(int code) {
        for (StatusEnum statusEnum : StatusEnum.values()) {
            if (code == statusEnum.getCode()) {
                return statusEnum;
            }
        }
        return StatusEnum.UNKNOW;
    }
}
